package com.lgz10.action;

import com.lgz10.entity.User;
import com.lgz10.service.UserService;
import com.opensymphony.xwork2.ActionSupport;

import java.util.List;

public class UserAction extends ActionSupport {
    private UserService userService;
    private User user;

    public List<User> getList() {
        return list;
    }

    public void setList(List<User> list) {
        this.list = list;
    }

    private List<User> list;

    public UserService getUserService() {
        return userService;
    }

    public void setUserService(UserService userService) {
        this.userService = userService;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
    public String saveUser(){
        System.out.println("userAction运行成功");
        userService.saveUser(user);
        return  "savesuccess";
    }
    public String queryUser(){
       list= userService.queryUser();
        return "querysuccess";
    }
    public String deleteUser(){
        userService.deleteUser(user);
        return "deletesuccess";
    }
    public String updateUser(){
        userService.updateUser(user);
        return "updatesuccess";
    }
    public String findById(){
        user=userService.findeById(user.getId());
        return "find";
    }
}
